package ManagedGenericIRPConstDefs;

/**
 * Generated from IDL union "UnsignedLongOpt".
 *
 * @author JacORB IDL compiler V 2.3.0, 17-Feb-2007
 * @version generated at 2013-5-20 22:07:19
 */

public final class UnsignedLongOptHelper
{
	private static org.omg.CORBA.TypeCode _type;
	public static void insert (final org.omg.CORBA.Any any, final ManagedGenericIRPConstDefs.UnsignedLongOpt s)
	{
		any.type(type());
		write( any.create_output_stream(),s);
	}

	public static ManagedGenericIRPConstDefs.UnsignedLongOpt extract (final org.omg.CORBA.Any any)
	{
		return read(any.create_input_stream());
	}

	public static String id()
	{
		return "IDL:ManagedGenericIRPConstDefs/UnsignedLongOpt:1.0";
	}
	public static UnsignedLongOpt read (org.omg.CORBA.portable.InputStream in)
	{
		UnsignedLongOpt result = new UnsignedLongOpt ();
		boolean disc=in.read_boolean();
			if (disc == true)
			{
				int _var;
				_var=in.read_ulong();
				result.value (_var);
			}
		return result;
	}
	public static void write (org.omg.CORBA.portable.OutputStream out, UnsignedLongOpt s)
	{
		out.write_boolean(s.discriminator ());
			if (s.discriminator () ==true)
			{
				out.write_ulong(s.value ());
			}
	}
	public static org.omg.CORBA.TypeCode type ()
	{
		if (_type == null)
		{
			org.omg.CORBA.UnionMember[] members = new org.omg.CORBA.UnionMember[1];
			org.omg.CORBA.Any label_any;
			label_any = org.omg.CORBA.ORB.init().create_any ();
			label_any.insert_boolean (true);
			members[0] = new org.omg.CORBA.UnionMember ("value", label_any, org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(5)),null);
			 _type = org.omg.CORBA.ORB.init().create_union_tc(id(),"UnsignedLongOpt",org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(8)), members);
		}
		return _type;
	}
}
